why does input.value is returning undefined when call it in alert